package com.yanqu.road.entity.activity.hsisland.data;

import com.yanqu.road.entity.DataObject;
import com.yanqu.road.entity.DataStatus;
import com.yanqu.road.entity.FieldTypeAnnotation;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;

@FieldTypeAnnotation(tableName = "t_c_activity_hs_island_floor_data")
public class HsIslandFloorData extends DataObject {

    @FieldTypeAnnotation(desc = "活动ID", select = true, update = true)
    private int activityId;

    @FieldTypeAnnotation(desc = "分组ID", select = true, update = true)
    private int groupId;

    @FieldTypeAnnotation(desc = "商会ID", select = true, update = true)
    private String unionId;

    @FieldTypeAnnotation(desc = "层ID", select = true, update = true)
    private int floorId;

    @FieldTypeAnnotation(desc = "宝箱岛屿ID")
    private int boxIslandId;

    @FieldTypeAnnotation(desc = "宝箱发现人")
    private long boxFindUserId;

    @FieldTypeAnnotation(desc = "宝箱MAP,K:x_y")
    private Map<String, HsIslandBoxData> boxDataMap;

    @FieldTypeAnnotation(desc = "最大事件唯一ID")
    private AtomicInteger maxUnEventId;

    @FieldTypeAnnotation(desc = "创建时间")
    private long createTime;

    public HsIslandFloorData() {
    }

    public HsIslandFloorData(int activityId, int groupId, String unionId, int floorId, int boxIslandId, Map<String, HsIslandBoxData> boxDataMap) {
        this.activityId = activityId;
        this.groupId = groupId;
        this.unionId = unionId;
        this.floorId = floorId;
        this.boxFindUserId = 0;
        this.boxIslandId = boxIslandId;
        this.boxDataMap = boxDataMap;
        this.maxUnEventId = new AtomicInteger(0);
        this.createTime = System.currentTimeMillis();
        setInsertOption();
    }

    public int getActivityId() {
        return activityId;
    }
    public void setActivityId(int activityId) {
        if (this.activityId != activityId) {
            this.activityId = activityId;
            setOp(DataStatus.Update);
        }
    }

    public int getGroupId() {
        return groupId;
    }
    public void setGroupId(int groupId) {
        if (this.groupId != groupId) {
            this.groupId = groupId;
            setOp(DataStatus.Update);
        }
    }

    public String getUnionId() {
        return unionId;
    }
    public void setUnionId(String unionId) {
        if (unionId == null){
            return;
        }
        if (this.unionId == null || !this.unionId.equals(unionId)) {
            this.unionId = unionId;
            setOp(DataStatus.Update);
        }
    }

    public int getFloorId() {
        return floorId;
    }
    public void setFloorId(int floorId) {
        if (this.floorId != floorId) {
            this.floorId = floorId;
            setOp(DataStatus.Update);
        }
    }

    public int getBoxIslandId() {
        return boxIslandId;
    }

    public void setBoxIslandId(int boxIslandId) {
        if (this.boxIslandId != boxIslandId) {
            this.boxIslandId = boxIslandId;
            setOp(DataStatus.Update);
        }
    }

    public long getBoxFindUserId() {
        return boxFindUserId;
    }

    public void setBoxFindUserId(long boxFindUserId) {
        if (this.boxFindUserId != boxFindUserId) {
            this.boxFindUserId = boxFindUserId;
            setOp(DataStatus.Update);
        }
    }

    public Map<String, HsIslandBoxData> getBoxDataMap() {
        return boxDataMap;
    }

    public void setBoxDataMap(Map<String, HsIslandBoxData> boxDataMap) {
        if (boxDataMap == null){
            return;
        }
        if (this.boxDataMap == null || !this.boxDataMap.equals(boxDataMap)) {
            this.boxDataMap = boxDataMap;
            setOp(DataStatus.Update);
        }
    }

    public AtomicInteger getMaxUnEventId() {
        return maxUnEventId;
    }

    public void setMaxUnEventId(AtomicInteger maxUnEventId) {
        if (maxUnEventId == null){
            return;
        }
        if (this.maxUnEventId == null || !(this.maxUnEventId.get() == maxUnEventId.get())) {
            this.maxUnEventId = maxUnEventId;
            setOp(DataStatus.Update);
        }
    }

    public long getCreateTime() {
        return createTime;
    }
    public void setCreateTime(long createTime) {
        if (this.createTime != createTime) {
            this.createTime = createTime;
            setOp(DataStatus.Update);
        }
    }
}
